

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>存储池 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="纠删码" href="../erasure-code/" />
    <link rel="prev" title="数据归置概览" href="../data-placement/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../">Ceph 存储集群</a> &raquo;</li>
        
          <li><a href="../">集群运维</a> &raquo;</li>
        
      <li>存储池</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/rados/operations/pools.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../configuration/">配置</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">运维</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../operating/">操纵集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-checks/">健康检查</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring/">监控集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring-osd-pg/">监控 OSD 和归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../user-management/">用户管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pg-repair/">修复 PG 不一致状态</a></li>
<li class="toctree-l3"><a class="reference internal" href="../data-placement/">数据归置概览</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">存储池</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id3">存储池命名</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">列出存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#createpool">创建存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#associate-pool-to-application">关联存储池与应用程序</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id8">设置存储池配额</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id9">删除存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id11">重命名存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id12">查看存储池统计信息</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id13">拍下存储池快照</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id14">删除存储池快照</a></li>
<li class="toctree-l4"><a class="reference internal" href="#setpoolvalues">调整存储池选项值</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id17">获取存储池选项值</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id18">设置对象副本数</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id19">获取对象副本数</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../erasure-code/">纠删码</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cache-tiering/">分级缓存</a></li>
<li class="toctree-l3"><a class="reference internal" href="../placement-groups/">归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../balancer/">均衡器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upmap/">使用 pg-upmap</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map/">CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map-edits/">手动编辑一个 CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../stretch-mode/">Stretch Clusters</a></li>
<li class="toctree-l3"><a class="reference internal" href="../change-mon-elections/">Configure Monitor Election Strategies</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-osds/">增加/删除 OSD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-mons/">增加/删除监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../devices/">设备管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../bluestore-migration/">迁移到 BlueStore</a></li>
<li class="toctree-l3"><a class="reference internal" href="../control/">命令参考</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/community/">Ceph 社区</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-mon/">监视器故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-osd/">OSD 故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-pg/">归置组排障</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/log-and-debug/">日志记录和调试</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/cpu-profiling/">CPU 剖析</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/memory-profiling/">内存剖析</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../man/">    手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="id1">
<h1>存储池<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h1>
<p>存储池是存储对象时的逻辑分区。</p>
<p>如果你开始部署集群时没有创建存储池， Ceph 会用默认存储池存数据。
存储池提供的功能：</p>
<ul class="simple">
<li><p><strong>自恢复力：</strong> 你可以设置在不丢数据的前提下允许多少 OSD 失效，
对多副本存储池来说，此值是一对象应达到的副本数。
典型配置是存储一个对象和它的两个副本（即 <code class="docutils literal notranslate"><span class="pre">size</span> <span class="pre">=</span> <span class="pre">3</span></code> ），
但你可以更改单个存储池的副本数；
对<a class="reference external" href="../erasure-code">纠删码存储池</a>来说，
此值是编码块数（即<strong>纠删码配置</strong>里的 <code class="docutils literal notranslate"><span class="pre">m=2</span></code> ）。</p></li>
<li><p><strong>归置组：</strong> 你可以设置一个存储池的归置组数量。
典型配置给每个 OSD 分配大约 100 个归置组，
这样，不用过多计算资源就能得到较优的均衡。
配置了多个存储池时，要整体考虑到各个存储池和整个集群的归置组数量都要合理。注意，
各个 PG 都属于某一个具体的存储池，所以多个存储池共用一些相同的 OSD 时，
你必须注意，每个 OSD 上 PG 数的 <strong>总和</strong> 才是它们的目标 PG 数。</p></li>
<li><p><strong>CRUSH 规则：</strong> 当你往存储池里存数据的时候，
此集群内对象及其副本（或纠删码存储池里的数据块）的归置由 CRUSH 规则控制。如果默认规则不符合你的使用情形，
你可以给自己的存储池定制 CRUSH 规则。</p></li>
<li><p><strong>快照：</strong> 用 <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">osd</span> <span class="pre">pool</span> <span class="pre">mksnap</span></code> 创建快照的时候，
实际上创建了某一特定存储池的快照。</p></li>
</ul>
<p>要把数据组织到存储池里，你可以列出、创建、删除存储池，
也可以查看每个存储池的利用率。</p>
<div class="section" id="id3">
<h2>存储池命名<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
<p>以 <code class="docutils literal notranslate"><span class="pre">.</span></code> 打头的存储池名字是为 Ceph 内部操作保留的，
请不要创建或修改这样的存储池。</p>
</div>
<div class="section" id="id4">
<h2>列出存储池<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
<p>要列出集群的存储池，命令如下：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">lspools</span>
</pre></div>
</div>
</div>
<div class="section" id="createpool">
<span id="id5"></span><h2>创建存储池<a class="headerlink" href="#createpool" title="Permalink to this headline">¶</a></h2>
<p>创建存储池前先看看<a class="reference external" href="../../configuration/pool-pg-config-ref">存储池、归置组和 CRUSH 配置参考</a>。
你最好在配置文件里重置默认归置组数量，因为默认值并不理想。
关于归置组数量请参考<a class="reference external" href="../placement-groups#set-the-number-of-placement-groups">设置归置组数量</a>。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>从 Luminous 版起，所有存储池都需要与使用它们的应用程序关联。
详情见<a class="reference internal" href="#id7">关联存储池与应用程序</a>。</p>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">osd_pool_default_pg_num</span> <span class="o">=</span> <span class="mi">128</span>
<span class="n">osd_pool_default_pgp_num</span> <span class="o">=</span> <span class="mi">128</span>
</pre></div>
</div>
<p>要创建一个存储池，执行：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">create</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">[{</span><span class="n">pg</span><span class="o">-</span><span class="n">num</span><span class="p">}</span> <span class="p">[{</span><span class="n">pgp</span><span class="o">-</span><span class="n">num</span><span class="p">}]]</span> <span class="p">[</span><span class="n">replicated</span><span class="p">]</span> \
     <span class="p">[</span><span class="n">crush</span><span class="o">-</span><span class="n">rule</span><span class="o">-</span><span class="n">name</span><span class="p">]</span> <span class="p">[</span><span class="n">expected</span><span class="o">-</span><span class="n">num</span><span class="o">-</span><span class="n">objects</span><span class="p">]</span>
<span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">create</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">[{</span><span class="n">pg</span><span class="o">-</span><span class="n">num</span><span class="p">}</span> <span class="p">[{</span><span class="n">pgp</span><span class="o">-</span><span class="n">num</span><span class="p">}]]</span>   <span class="n">erasure</span> \
     <span class="p">[</span><span class="n">erasure</span><span class="o">-</span><span class="n">code</span><span class="o">-</span><span class="n">profile</span><span class="p">]</span> <span class="p">[</span><span class="n">crush</span><span class="o">-</span><span class="n">rule</span><span class="o">-</span><span class="n">name</span><span class="p">]</span> <span class="p">[</span><span class="n">expected_num_objects</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">autoscale</span><span class="o">-</span><span class="n">mode</span><span class="o">=&lt;</span><span class="n">on</span><span class="p">,</span><span class="n">off</span><span class="p">,</span><span class="n">warn</span><span class="o">&gt;</span><span class="p">]</span>
</pre></div>
</div>
<p>参数含义如下：</p>
<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">{pool-name}</span></code></dt>
<dd><p>存储池名称，必须唯一。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需</dt>
<dd class="field-even"><p>必需。</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">{pg-num}</span></code></dt>
<dd><p>存储池拥有的归置组总数。
关于如何计算合适的数值，请参见<a class="reference internal" href="../placement-groups/#id1"><span class="std std-ref">归置组</span></a>。
默认值 <code class="docutils literal notranslate"><span class="pre">8</span></code> 对大多数系统都 <strong>不合适</strong> 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">是否必需</dt>
<dd class="field-even"><p>Yes</p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p>8</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">{pgp-num}</span></code></dt>
<dd><p>用于归置的归置组总数。
此值<strong>应该等于归置组总数</strong>，
归置组分割的情况下除外。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">是否必需</dt>
<dd class="field-even"><p>没指定的话读取默认值、或 Ceph 配置文件里的值。</p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p>8</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">{replicated|erasure}</span></code></dt>
<dd><p>存储池类型，可以是<strong>replicated （多副本）</strong>
（保存多份对象副本，以便从丢失的 OSD 恢复）
或<strong>erasure （纠删）</strong>（获得类似 <a class="reference external" href="../erasure-code">通用 RAID5</a> 的恢复能力）。
<strong>replicated</strong> 存储池需更多原始存储空间，
但已实现所有 Ceph 操作；
<strong>纠删码</strong>存储池所需原始存储空间较少，但目前仅实现了部分 Ceph 操作。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需</dt>
<dd class="field-even"><p>No.</p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p>replicated</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">[crush-rule-name]</span></code></dt>
<dd><p>此存储池所用的 CRUSH 规则名字。
指定的规则必须存在。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需</dt>
<dd class="field-even"><p>No.</p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p>对于多副本存储池（ <strong>replicated pool</strong> ）来说，
其规则由 <a class="reference internal" href="../../configuration/pool-pg-config-ref/#confval-osd_pool_default_crush_rule"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_pool_default_crush_rule</span></code></a> 配置决定，
此规则必须存在。对于纠删码存储池（ <strong>erasure pool</strong> ）来说，
如果用的是 <code class="docutils literal notranslate"><span class="pre">default</span></code> <a class="reference external" href="../erasure-code-profile">纠删码配置</a>那就是 <code class="docutils literal notranslate"><span class="pre">erasure-code</span></code> ，
否则就是 <code class="docutils literal notranslate"><span class="pre">{pool-name}</span></code> 。如果此规则不存在，会悄悄地创建。</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">[erasure-code-profile=profile]</span></code></dt>
<dd><p>仅适用于<strong>纠删</strong>存储池。指定<a class="reference external" href="../erasure-code-profile">纠删码配置</a>框架，此配置必须已经由 <strong>osd erasure-code-profile set</strong>
定义好了。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需</dt>
<dd class="field-even"><p>No.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">--autoscale-mode=&lt;on,off,warn&gt;</span></code></dt>
<dd><p>如果你把 autoscale 模式设置为 <code class="docutils literal notranslate"><span class="pre">on</span></code> 或 <code class="docutils literal notranslate"><span class="pre">warn</span></code> ，
系统会根据使用情况分别会自动调整、或给存储池里的归置组推荐一个数量，
如果让它保持关闭，你应该参考一下 <a class="reference internal" href="../placement-groups/#id1"><span class="std std-ref">归置组</span></a>。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">是否必需</dt>
<dd class="field-even"><p>No.</p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p>默认行为由 <code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_pool_default_pg_autoscale</span></code> 选项控制。</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">[expected-num-objects]</span></code></dt>
<dd><p>为这个存储池预估的对象数。
设置此值（要同时把 <strong>filestore merge threshold</strong> 设置为负数）后，
在创建存储池时就会拆分 PG 文件夹，
以免运行时拆分文件夹导致延时增大。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">是否必需</dt>
<dd class="field-even"><p>No.</p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p>0 ，创建存储池时不拆分目录。</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="associate-pool-to-application">
<span id="id7"></span><h2>关联存储池与应用程序<a class="headerlink" href="#associate-pool-to-application" title="Permalink to this headline">¶</a></h2>
<p>存储池要先与应用程序关联才能使用。
要用于 CephFS 的存储池、或由 RGW 创建的存储池已经自动关联过了；
计划用于 RBD 的存储池应该用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 工具初始化
（详情见<a class="reference external" href="../../../rbd/rados-rbd-cmds/#create-a-block-device-pool">块设备命令</a>）。</p>
<p>对于其它案例，你可以手动关联存储池与应用程序名字。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">application</span> <span class="n">enable</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">{</span><span class="n">application</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>CephFS 的应用程序名字是 <code class="docutils literal notranslate"><span class="pre">cephfs</span></code> ； RBD 的应用程序名字是 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> ， RGW 的应用程序名字是 <code class="docutils literal notranslate"><span class="pre">rgw</span></code> 。</p>
</div>
</div>
<div class="section" id="id8">
<h2>设置存储池配额<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h2>
<p>存储池配额可设置最大字节数、和/或每存储池最大对象数。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="nb">set</span><span class="o">-</span><span class="n">quota</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">[</span><span class="n">max_objects</span> <span class="p">{</span><span class="n">obj</span><span class="o">-</span><span class="n">count</span><span class="p">}]</span> <span class="p">[</span><span class="n">max_bytes</span> <span class="p">{</span><span class="nb">bytes</span><span class="p">}]</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="nb">set</span><span class="o">-</span><span class="n">quota</span> <span class="n">data</span> <span class="n">max_objects</span> <span class="mi">10000</span>
</pre></div>
</div>
<p>要取消配额，设置为 <code class="docutils literal notranslate"><span class="pre">0</span></code> 。</p>
</div>
<div class="section" id="id9">
<h2>删除存储池<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h2>
<p>要删除一存储池，执行：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">delete</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">[{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="o">--</span><span class="n">yes</span><span class="o">-</span><span class="n">i</span><span class="o">-</span><span class="n">really</span><span class="o">-</span><span class="n">really</span><span class="o">-</span><span class="n">mean</span><span class="o">-</span><span class="n">it</span><span class="p">]</span>
</pre></div>
</div>
<p>要删除存储池，监视器配置的 mon_allow_pool_delete 标志必须设置为 true ，
否则它会拒绝删除存储池。</p>
<p>详情见<a class="reference external" href="../../configuration/mon-config-ref">监视器配置</a>。</p>
<p>如果你给自建的存储池创建了定制的规则，那么没有存储池在用它时你应该删掉它：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">get</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="n">crush_rule</span>
</pre></div>
</div>
<p>假设规则 id 为 123 ，你可以这样找出还在用它的其它存储池：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">dump</span> <span class="o">|</span> <span class="n">grep</span> <span class="s2">&quot;^pool&quot;</span> <span class="o">|</span> <span class="n">grep</span> <span class="s2">&quot;crush_rule 123&quot;</span>
</pre></div>
</div>
<p>如果没有别的存储池使用这个定制规则，那就可以安全地从集群里删掉它。</p>
<p>如果你曾创建过一些用户及其权限、并与存储池绑死了，但如今这些存储池已不存在，最好也删除那些用户：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">auth</span> <span class="n">ls</span> <span class="o">|</span> <span class="n">grep</span> <span class="o">-</span><span class="n">C</span> <span class="mi">5</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
<span class="n">ceph</span> <span class="n">auth</span> <span class="k">del</span> <span class="p">{</span><span class="n">user</span><span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="id11">
<h2>重命名存储池<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h2>
<p>要重命名一个存储池，执行：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">rename</span> <span class="p">{</span><span class="n">current</span><span class="o">-</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">{</span><span class="n">new</span><span class="o">-</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>如果重命名了一个存储池，且认证用户有每存储池能力，
那你必须用新存储池名字更新用户的能力（即 caps ）。</p>
</div>
<div class="section" id="id12">
<h2>查看存储池统计信息<a class="headerlink" href="#id12" title="Permalink to this headline">¶</a></h2>
<p>要查看某存储池的使用统计信息，执行命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rados</span> <span class="n">df</span>
</pre></div>
</div>
<p>另外，要获取某个或所有存储池的 I/O 信息，用命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">stats</span> <span class="p">[{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}]</span>
</pre></div>
</div>
</div>
<div class="section" id="id13">
<h2>拍下存储池快照<a class="headerlink" href="#id13" title="Permalink to this headline">¶</a></h2>
<p>要拍下某存储池的快照，执行命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">mksnap</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">{</span><span class="n">snap</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="id14">
<h2>删除存储池快照<a class="headerlink" href="#id14" title="Permalink to this headline">¶</a></h2>
<p>要删除某存储池的一个快照，执行命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">rmsnap</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">{</span><span class="n">snap</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="setpoolvalues">
<span id="id15"></span><h2>调整存储池选项值<a class="headerlink" href="#setpoolvalues" title="Permalink to this headline">¶</a></h2>
<p>要设置一个存储池的选项值，执行命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="nb">set</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">{</span><span class="n">key</span><span class="p">}</span> <span class="p">{</span><span class="n">value</span><span class="p">}</span>
</pre></div>
</div>
<p>你可以设置下列键的值：</p>
<span class="target" id="compression-algorithm"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">compression_algorithm</span></code></dt>
<dd><p>设置底层 BlueStore 所用的内联压缩算法。
此选项会覆盖全局配置 <a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_algorithm"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_algorithm</span></code></a> 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">有效选项</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">lz4</span></code>, <code class="docutils literal notranslate"><span class="pre">snappy</span></code>, <code class="docutils literal notranslate"><span class="pre">zlib</span></code>, <code class="docutils literal notranslate"><span class="pre">zstd</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">compression_mode</span></code></dt>
<dd><p>设置底层 BlueStore 所用压缩算法的策略。
此选项会覆盖全局配置 <a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_mode"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_mode</span></code></a> 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">有效选项</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">none</span></code>, <code class="docutils literal notranslate"><span class="pre">passive</span></code>, <code class="docutils literal notranslate"><span class="pre">aggressive</span></code>, <code class="docutils literal notranslate"><span class="pre">force</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">compression_min_blob_size</span></code></dt>
<dd><p>小于这个的数据块不会被压缩。此选项会覆盖全局配置
<a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_min_blob_size"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_min_blob_size</span></code></a> 、
<a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_min_blob_size_hdd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_min_blob_size_hdd</span></code></a> 、和
<a class="reference internal" href="../../configuration/bluestore-config-ref/#confval-bluestore_compression_min_blob_size_ssd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_compression_min_blob_size_ssd</span></code></a> 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Unsigned Integer</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">compression_max_blob_size</span></code></dt>
<dd><p>大于此数值的数据块在压缩前会破碎成尺寸为 <code class="docutils literal notranslate"><span class="pre">compression_max_blob_size</span></code> 的较小二进制块。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Unsigned Integer</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="size"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">size</span></code></dt>
<dd><p>设置存储池中的对象副本数，详情参见<a class="reference internal" href="#id18">设置对象副本数</a>。
仅适用于多副本存储池。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="min-size"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">min_size</span></code></dt>
<dd><p>设置 I/O 需要的最小副本数，详情参见<a class="reference internal" href="#id18">设置对象副本数</a> 。
对于纠删码存储池，这个值应该设置成大于 k 的值，因为，
如果我们让这个值等于 k ，那就没有冗余，
在遇到永久的 OSD 故障这样的事件时，数据会丢失。
更多信息见<a class="reference external" href="../erasure-code">纠删码</a> 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">适用版本</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0.54</span></code> 及以上。</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="pg-num"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">pg_num</span></code></dt>
<dd><p>计算数据归置时使用的有效归置组数量。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>不高于 <code class="docutils literal notranslate"><span class="pre">pg_num</span></code> 的当前值。</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="pgp-num"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">pgp_num</span></code></dt>
<dd><p>计算数据归置时使用的、用于归置的有效归置组数量。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>等于或小于 <code class="docutils literal notranslate"><span class="pre">pg_num</span></code> 。</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="crush-rule"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">crush_rule</span></code></dt>
<dd><p>集群内映射对象归置时使用的规则。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>String</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="allow-ec-overwrites"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">allow_ec_overwrites</span></code></dt>
<dd><p>写入一个纠删码存储池时是否允许更新对象的部分数据，
允许后 CephFS 和 RBD 才能用这个存储池，
详情见<a class="reference external" href="../erasure-code#erasure-coding-with-overwrites">在纠删码存储池上启用重写功能</a>。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Boolean</p>
</dd>
</dl>
<div class="versionadded">
<p><span class="versionmodified added">New in version 12.2.0.</span></p>
</div>
</dd></dl>

<span class="target" id="hashpspool"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">hashpspool</span></code></dt>
<dd><p>给指定存储池设置/取消 HASHPSPOOL 标志。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>1 开启， 0 取消</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="nodelete"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">nodelete</span></code></dt>
<dd><p>给指定存储池设置/取消 NODELETE 标志。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>1 开启， 0 取消</p>
</dd>
<dt class="field-odd">适用版本</dt>
<dd class="field-odd"><p>Version <code class="docutils literal notranslate"><span class="pre">FIXME</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="nopgchange"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">nopgchange</span></code></dt>
<dd><p>给指定存储池设置/取消 NOPGCHANGE 标志。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>1 开启， 0 取消</p>
</dd>
<dt class="field-odd">适用版本</dt>
<dd class="field-odd"><p>Version <code class="docutils literal notranslate"><span class="pre">FIXME</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="nosizechange"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">nosizechange</span></code></dt>
<dd><p>给指定存储池设置/取消 NOSIZECHANGE 标志。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>1 开启， 0 取消</p>
</dd>
<dt class="field-odd">适用版本</dt>
<dd class="field-odd"><p>Version <code class="docutils literal notranslate"><span class="pre">FIXME</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="bulk"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">bulk</span></code></dt>
<dd><p>设置、取消指定存储池的 bulk 标志。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Boolean</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>true/1 设置标志， false/0 取消标志</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="write-fadvise-dontneed"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">write_fadvise_dontneed</span></code></dt>
<dd><p>设置或取消指定存储池的 WRITE_FADVISE_DONTNEED 标志。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>1 开启， 0 取消</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="noscrub"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">noscrub</span></code></dt>
<dd><p>设置或取消指定存储池的 NOSCRUB 标志。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>1 设置， 0 取消</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="nodeep-scrub"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">nodeep-scrub</span></code></dt>
<dd><p>设置或取消指定存储池的 NODEEP_SCRUB 标志。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>1 开启， 0 取消</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="hit-set-type"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">hit_set_type</span></code></dt>
<dd><p>启用缓存存储池的命中集跟踪，
详情见 <a class="reference external" href="https://en.wikipedia.org/wiki/Bloom_filter">Bloom 过滤器</a>。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>String</p>
</dd>
<dt class="field-even">有效值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">bloom</span></code>, <code class="docutils literal notranslate"><span class="pre">explicit_hash</span></code>, <code class="docutils literal notranslate"><span class="pre">explicit_object</span></code></p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">bloom</span></code> ，其它是用于测试的。</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="hit-set-count"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">hit_set_count</span></code></dt>
<dd><p>为缓存存储池保留的命中集数量。此值越高，
<code class="docutils literal notranslate"><span class="pre">ceph-osd</span></code> 守护进程消耗的内存越多。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">1</span></code>. Agent doesn’t handle &gt; 1 yet.</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="hit-set-period"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">hit_set_period</span></code></dt>
<dd><p>为缓存存储池保留的命中集有效期。
此值越高， <code class="docutils literal notranslate"><span class="pre">ceph-osd</span></code> 消耗的内存
越多。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">实例</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">3600</span></code> 1hr</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="hit-set-fpp"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">hit_set_fpp</span></code></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">bloom</span></code> 命中集类型的假阳性概率。
详情见 <a class="reference external" href="https://en.wikipedia.org/wiki/Bloom_filter">Bloom 过滤器</a>。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Double</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>0.0 - 1.0</p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0.05</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="cache-target-dirty-ratio"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">cache_target_dirty_ratio</span></code></dt>
<dd><p>缓存存储池包含的已修改（脏 dirty ）对象达到多大百分比时，
分级缓存代理就把它们回写到后端的存储池。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Double</p>
</dd>
<dt class="field-even">默认值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">.4</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="cache-target-dirty-high-ratio"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">cache_target_dirty_high_ratio</span></code></dt>
<dd><p>缓存存储池内包含的已修改（脏的）对象达到这个百分比时，缓存层代理就会更快地把脏对象刷回到后端存储池。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Double</p>
</dd>
<dt class="field-even">默认值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">.6</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="cache-target-full-ratio"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">cache_target_full_ratio</span></code></dt>
<dd><p>缓存存储池包含的未修改（干净的）对象达到多大百分比时，分级缓存代理就把它们赶出缓存存储池。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Double</p>
</dd>
<dt class="field-even">默认值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">.8</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="target-max-bytes"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">target_max_bytes</span></code></dt>
<dd><p>达到 <code class="docutils literal notranslate"><span class="pre">max_bytes</span></code> 阀值时
Ceph 就回写或赶出对象。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">实例</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">1000000000000</span></code>  #1-TB</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="target-max-objects"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">target_max_objects</span></code></dt>
<dd><p>达到 <code class="docutils literal notranslate"><span class="pre">max_objects</span></code> 阀值时
Ceph 就回写或赶出对象。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">实例</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">1000000</span></code> #1M objects</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">hit_set_grade_decay_rate</span></code></dt>
<dd><p>在两个连续 hit_sets 间的热度衰退速率。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>0 - 100</p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">20</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">hit_set_search_last_n</span></code></dt>
<dd><p>计算热度时，在 hit_sets 里最多计数 N 次。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">有效范围</dt>
<dd class="field-even"><p>0 - hit_set_count</p>
</dd>
<dt class="field-odd">默认值</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="cache-min-flush-age"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">cache_min_flush_age</span></code></dt>
<dd><p>达到此时间（单位为秒）时，分级缓存代理就把某些对象从缓存存储池刷回到存储池。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">实例</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">600</span></code> 10min</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="cache-min-evict-age"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">cache_min_evict_age</span></code></dt>
<dd><p>达到此时间（单位为秒）时，分级缓存代理就把某些对象从缓存存储池赶出。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>整数</p>
</dd>
<dt class="field-even">实例</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">1800</span></code> 30min</p>
</dd>
</dl>
</dd></dl>

<span class="target" id="fast-read"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">fast_read</span></code></dt>
<dd><p>在纠删码存储池上，如果打开了这个标志，
读请求会向所有分片发送子操作读，然后等着，
直到收到的分片足以解码给客户端。
对 jerasure 和 isa 纠删码插件来说，只要前 K 个请求返回，
就能立即解码、并先把这些数据发给客户端。
这样有助于资源折衷，以提升性能。
当前，这些标志还只能用于纠删码存储池。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Boolean</p>
</dd>
<dt class="field-even">默认值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="scrub-min-interval"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">scrub_min_interval</span></code></dt>
<dd><p>在负载低时，洗刷存储池的最小间隔秒数。
如果是 0 ，就按照配置文件里的
osd_scrub_min_interval 执行。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Double</p>
</dd>
<dt class="field-even">默认值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="scrub-max-interval"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">scrub_max_interval</span></code></dt>
<dd><p>不管集群负载如何，都要洗刷存储池的最大间隔秒数。
如果是 0 ，就按照配置文件里的
osd_scrub_max_interval 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Double</p>
</dd>
<dt class="field-even">默认值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="deep-scrub-interval"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">deep_scrub_interval</span></code></dt>
<dd><p>“深度”洗刷存储池的间隔秒数。
如果是 0 ，就按照配置文件里的 osd_deep_scrub_interval 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Double</p>
</dd>
<dt class="field-even">默认值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="recovery-priority"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">recovery_priority</span></code></dt>
<dd><p>设置此值后，它会提高或降低计算出的保留优先级，
此值必须介于 -10 到 10 之间。
给不太重要的存储池分配负值，
其优先级就低于其它新存储池。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">默认值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="recovery-op-priority"></span><dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">recovery_op_priority</span></code></dt>
<dd><p>指定此存储池恢复操作的优先级，而非 <a class="reference internal" href="../../configuration/osd-config-ref/#confval-osd_recovery_op_priority"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_recovery_op_priority</span></code></a> 。</p>
<dl class="field-list simple">
<dt class="field-odd">类型</dt>
<dd class="field-odd"><p>Integer</p>
</dd>
<dt class="field-even">默认值</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="id17">
<h2>获取存储池选项值<a class="headerlink" href="#id17" title="Permalink to this headline">¶</a></h2>
<p>要获取一个存储池的选项值，执行命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">get</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span> <span class="p">{</span><span class="n">key</span><span class="p">}</span>
</pre></div>
</div>
<p>你可以获取到下列选项的值：</p>
<p><code class="docutils literal notranslate"><span class="pre">size</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#size">size</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">min_size</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#min-size">min_size</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">适用版本</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0.54</span></code> 及以上</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">pg_num</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#pg-num">pg_num</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">pgp_num</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#pgp-num">pgp_num</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
<dt class="field-odd">有效范围</dt>
<dd class="field-odd"><p>小于等于 <code class="docutils literal notranslate"><span class="pre">pg_num</span></code> 。</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">crush_rule</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#crush-rule">crush_rule</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">hit_set_type</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#hit-set-type">hit_set_type</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">有效选项</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">bloom</span></code> 、 <code class="docutils literal notranslate"><span class="pre">explicit_hash</span></code> 、 <code class="docutils literal notranslate"><span class="pre">explicit_object</span></code></p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">hit_set_count</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#hit-set-count">hit_set_count</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">hit_set_period</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#hit-set-period">hit_set_period</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">hit_set_fpp</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#hit-set-fpp">hit_set_fpp</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">cache_target_dirty_ratio</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#cache-target-dirty-ratio">cache_target_dirty_ratio</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">cache_target_dirty_high_ratio</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#cache-target-dirty-high-ratio">cache_target_dirty_high_ratio</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">cache_target_full_ratio</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#cache-target-full-ratio">cache_target_full_ratio</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">target_max_bytes</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#target-max-bytes">target_max_bytes</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">target_max_objects</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#target-max-objects">target_max_objects</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">cache_min_flush_age</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#cache-min-flush-age">cache_min_flush_age</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">cache_min_evict_age</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#cache-min-evict-age">cache_min_evict_age</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>整数</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">fast_read</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#fast-read">fast_read</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Boolean</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">scrub_min_interval</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#scrub-min-interval">scrub_min_interval</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">scrub_max_interval</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#scrub-max-interval">scrub_max_interval</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">deep_scrub_interval</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#deep-scrub-interval">deep_scrub_interval</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Double</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">allow_ec_overwrites</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#allow-ec-overwrites">allow_ec_overwrites</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Boolean</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">recovery_priority</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#recovery-priority">recovery_priority</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Integer</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">recovery_op_priority</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述</dt>
<dd class="field-odd"><p>见 <a class="reference internal" href="#recovery-op-priority">recovery_op_priority</a></p>
</dd>
<dt class="field-even">类型</dt>
<dd class="field-even"><p>Integer</p>
</dd>
</dl>
</div>
<div class="section" id="id18">
<h2>设置对象副本数<a class="headerlink" href="#id18" title="Permalink to this headline">¶</a></h2>
<p>要设置多副本存储池的对象副本数，执行命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="nb">set</span> <span class="p">{</span><span class="n">poolname</span><span class="p">}</span> <span class="n">size</span> <span class="p">{</span><span class="n">num</span><span class="o">-</span><span class="n">replicas</span><span class="p">}</span>
</pre></div>
</div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p><code class="docutils literal notranslate"><span class="pre">{num-replicas}</span></code> 包括对象自身，
如果你想要对象自身及其两份拷贝共计三份，
指定 3 。</p>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="nb">set</span> <span class="n">data</span> <span class="n">size</span> <span class="mi">3</span>
</pre></div>
</div>
<p>你可以在每个存储池上执行这个命令。<strong>注意</strong>，
一个处于降级模式的对象其副本数小于规定值 <code class="docutils literal notranslate"><span class="pre">pool</span> <span class="pre">size</span></code> ，
但仍可接受 I/O 请求。为保证 I/O 正常，
可用 <code class="docutils literal notranslate"><span class="pre">min_size</span></code> 选项为其设置个最低副本数。例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="nb">set</span> <span class="n">data</span> <span class="n">min_size</span> <span class="mi">2</span>
</pre></div>
</div>
<p>这确保数据存储池里任何副本数小于 <code class="docutils literal notranslate"><span class="pre">min_size</span></code> 的对象都不会收到 I/O 了。</p>
</div>
<div class="section" id="id19">
<h2>获取对象副本数<a class="headerlink" href="#id19" title="Permalink to this headline">¶</a></h2>
<p>要获取对象副本数，执行命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">dump</span> <span class="o">|</span> <span class="n">grep</span> <span class="s1">&#39;replicated size&#39;</span>
</pre></div>
</div>
<p>Ceph 会列出存储池，且高亮 <code class="docutils literal notranslate"><span class="pre">replicated</span> <span class="pre">size</span></code> 属性。默认情况下，
Ceph 会创建一对象的两个副本（一共三个副本，或 size 值为 3 ）。</p>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../erasure-code/" class="btn btn-neutral float-right" title="纠删码" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../data-placement/" class="btn btn-neutral float-left" title="数据归置概览" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>